package com.sgb.kjwl.model.api;

import com.sgb.kjwl.model.entity.BidDetailEntity;
import com.sgb.kjwl.model.entity.BidInvitationListEntity;
import com.sgb.jicai.entity.FilterEntity;
import com.sgb.kjwl.model.entity.LoginEntity;
import com.sgb.link.entity.PublicTypeEntity;
import com.sgb.kjwl.model.entity.UserMsgEntity;
import com.sgb.kjwl.model.entity.self.GoodsListEntity3;
import com.sgb.kjwl.model.entity.self.SelfPickListEntity3;
import com.sgb.kjwl.model.entity.supplier3.DictEntity3;
import com.sgb.kjwl.model.entity.user.AddDeviceEntity;
import com.sgb.kjwl.model.entity.user.AddGoodsEntity;
import com.sgb.kjwl.model.entity.user.AddMachineInEntity;
import com.sgb.kjwl.model.entity.user.AddMachineOutEntity;
import com.sgb.kjwl.model.entity.user.AddPackersEntity;
import com.sgb.kjwl.model.entity.user.AddTalentEntity;
import com.sgb.kjwl.model.entity.user.AddressEntity;
import com.sgb.kjwl.model.entity.user.AuthEntity;
import com.sgb.kjwl.model.entity.user.CategoryEntity;
import com.sgb.kjwl.model.entity.user.DeviceStateEntity;
import com.sgb.kjwl.model.entity.user.DictEntity;
import com.sgb.kjwl.model.entity.user.GoodsEntity;
import com.sgb.kjwl.model.entity.user.MachineStateEntity;
import com.sgb.kjwl.model.entity.user.MachineryCompanyEntity;
import com.sgb.kjwl.model.entity.user.PackersStateEntity;
import com.sgb.kjwl.model.entity.user.PhotoEntity;
import com.sgb.kjwl.model.entity.user.SupplierAuthEntity;
import com.sgb.kjwl.model.entity.user.TalentTypeEntity;
import com.sgb.kjwl.model.entity.user.UnitEntity;
import com.sgb.kjwl.model.entity.user.UserAddressEntity;
import com.swgk.core.base.model.entity.ListResponse;
import com.swgk.core.base.model.entity.BaseEntity;
import com.swgk.core.base.model.factory.BaseUrlInterceptor;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.PartMap;
import retrofit2.http.Path;
import retrofit2.http.Query;

/**
 * Description:
 * Author zhengkewen
 * Time 2019/4/2
 */
public interface UserInterface {
    //认证中心
    //认证状态查询

    //用户登陆
    @FormUrlEncoded
    @POST("api/shop/token")
    Observable<LoginEntity> login(@Field("username") String username, @Field("password") String password, @Field("grant_type") String grant_type, @Field("remember_me") String remember_me, @Field("code") String code);

    //用户退出
    @POST("authentication/removeToken")
    Observable<BaseEntity> loginOut(@Query("accesstoken") String accesstoken);

    //忘记密码
    @POST("api/user/forget")
    Observable<BaseEntity> forgetPwd(@Body Map map);

    //找回密码获取验证码
    @GET("api/user/forgetCode")
    Observable<BaseEntity> getForgetCode(@Query("tel") String phone);

    //用户注册获取验证码
    @GET("api/user/getRegisterCode")
    Observable<BaseEntity> getRegisterCode(@Query("telPhone") String phone);

    //用户注册
    @POST("api/user/add")
    Observable<BaseEntity> register(@Body Map map);

    //token校验
    @POST("authentication/checkToken")
    Observable<BaseEntity> checkToken(@Body Map map);

    //获取当前登录用户信息
    @GET("api/user/getCurrentUserInfo")
    Observable<BaseEntity<UserMsgEntity>> getCurrentUserInfo();

    //获取供应商认证信息
    @GET("api/auth/getSupplier")
    Observable<BaseEntity<SupplierAuthEntity>> getSupplierAuthInfo();

    //应商认证信息
    @POST("api/auth/supplierAuth")
    Observable<BaseEntity> addSupplierAuth(@Body SupplierAuthEntity supplierAuthEntity);

    //上传营业执照
    @Multipart
    @POST("file/recognition")
    Observable<BaseEntity<PhotoEntity>> uploadPhoto(@PartMap Map<String, RequestBody> photos);

    //上传文件(单个)
    @Multipart
    @POST("file/add")
    Observable<BaseEntity> uploadFile(@PartMap Map<String, RequestBody> files);

    //上传多个文件
    @Multipart
    @POST("file/addFiles")
    Observable<BaseEntity<List<String>>> uploadMutiFile(@PartMap Map<String, RequestBody> files);

    //获取企业类型
    @GET("api/auth/getCompanyType")
    Observable<List<String>> getCompanyType();

    //获取营业范围
    @GET("api/auth/business")
    Observable<BaseEntity<List<DictEntity>>> getBusiness();

    //获取省市区地址
    @GET("v1/app/user/talent/areaList")
    Observable<BaseEntity<List<AddressEntity<List<AddressEntity<List<AddressEntity>>>>>>> getAddress();

    //获取发布公用地址接口
    @GET("v1/app/user/talent/areaList")
    Observable<BaseEntity<List<AddressEntity<List<AddressEntity>>>>> getCommonAddress();

    //工程工队发布
    //获取我的工队列表
    @GET("v1/app/user/packer/teamList")
    Observable<BaseEntity<ListResponse<List<PackersStateEntity>>>> getPublishPackers(@Query("page") int page, @Query("limit") int size, @Query("status") String status, @Query("title") String title);

    //工队上架
    @POST("v1/app/user/packer/on")
    Observable<BaseEntity> onPacker(@Body Map map);

    //工队下架
    @POST("v1/app/user/packer/off")
    Observable<BaseEntity> offPacker(@Body Map map);

    //工队删除
    @POST("v1/app/user/packer/delete")
    Observable<BaseEntity> delPackersList(@Body Map map);

    //工队分类
    @POST("v1/app/user/packer/categoryList")
    Observable<BaseEntity<List<CategoryEntity<CategoryEntity>>>> getPackersCategory();

    //新增工队
    @POST("v1/app/user/packer/addTeam")
    Observable<BaseEntity> addPackers(@Body AddPackersEntity entity);

    //编辑工队
    @POST("v1/app/user/packer/editTeam")
    Observable<BaseEntity> editPackers(@Body AddPackersEntity entity);

    //获取工队详情
    @GET("v1/app/user/packer/getById")
    Observable<BaseEntity<AddPackersEntity>> getPackersDetail(@Query("id") String id);

    //获取工队所在地
    @GET("sysArea/0")
    Observable<BaseEntity<List<AddressEntity<List<AddressEntity>>>>> getPackersAddress();

    //人才发布
    //新增人才
    @POST("v1/app/user/talent/add")
    Observable<BaseEntity> addTalent(@Body AddTalentEntity entity);

    //编辑人才
    @POST("v1/app/user/talent/edit")
    Observable<BaseEntity> editTalent(@Body AddTalentEntity entity);

    //获取人才详情
    @GET("v1/app/user/talent/myTalent")
    Observable<BaseEntity<AddTalentEntity>> getTalentDetail();

    //获取人才类目
    @GET("v1/app/user/talent/categoryList")
    Observable<BaseEntity<List<TalentTypeEntity<List<TalentTypeEntity>>>>> getTalentType();

    //设备发布
    //获取出租设备列表
    @GET("v1/app/equipmentRent/myList")
    Observable<BaseEntity<ListResponse<List<DeviceStateEntity>>>> getPublishDevice(@Query("page") int page, @Query("limit") int size, @Query("status") String status,@Query("text") String text);

    //新增设备
    @POST("v1/app/equipmentRent/add")
    Observable<BaseEntity> addDevice(@Body AddDeviceEntity entity);

    //编辑设备
    @POST("v1/app/equipmentRent/update")
    Observable<BaseEntity> updateDevice(@Body AddDeviceEntity entity);

    //出租设备上下架
    @POST("v1/app/equipmentRent/putOut")
    Observable<BaseEntity> deviceOnlineOrOff(@Body Map map);

    //设备删除
    @POST("v1/app/equipmentRent/delete")
    Observable<BaseEntity> delDeviceList(@Body Map map);

    //获取设备价格单位
    @GET("v1/app/equipmentRent/unitList")
    Observable<BaseEntity<List<UnitEntity>>> getDeviceUnit();

    //获取设备分类类型
    @GET("v1/app/equipment/categoryList")
    Observable<BaseEntity<List<PublicTypeEntity<List<PublicTypeEntity>>>>> getDeviceType(@Query("categoryNo") String categoryNo);

    //获取设备详情
    @GET("v1/app/equipmentRent/detail")
    Observable<BaseEntity<AddDeviceEntity>> getPublishDeviceDetail(@Query("id") String id);

    //获取设备服务范围
    @GET("api/auth/{level}")
    Observable<BaseEntity<List<AddressEntity>>> getDeviceAddress(@Path("level") String level, @Query("parentNo") String parentNo);

    //获取设备属性
    @GET("v1/app/equipmentRent/attributeList/")
    Observable<BaseEntity<List<FilterEntity<List<FilterEntity>>>>> getPulishDeviceAttr(@Query("categoryNo") String categoryNo, @Query("typeNo") String typeNo);

    //机械发布
    //获取价格单位
    @GET("v1/app/rentInfo/unitList")
    Observable<BaseEntity<List<DictEntity>>> getMachinePrice();

    //获取机械类型
    @GET("v1/app/machinery/categoryList")
    Observable<BaseEntity<List<PublicTypeEntity<List<PublicTypeEntity>>>>> getMachineOutType();

    //获取机械属性
    @GET("v1/app/rentInfo/getAttrList")
    Observable<BaseEntity<List<FilterEntity<List<FilterEntity>>>>> getMachineDict(@Query("categoryNo") String categoryNo, @Query("typeNo") String typeNo);

    //新增机械出租发布
    @Headers({BaseUrlInterceptor.HEADERS_URL_ZL, "tokenType:pc"})
    @POST("v1/app/rentInfo/addOrupdate")
    Observable<BaseEntity> addMachineOut(@Body AddMachineOutEntity entity);

//    //编辑机械出租发布
//    @PUT("v1/app/rentInfo/update")
//    Observable<BaseEntity> editMachineOut(@Body AddMachineOutEntity entity);

    //获取机械出租列表
    @GET("v1/app/rentInfo/myList")
    Observable<BaseEntity<ListResponse<List<MachineStateEntity>>>> getPublishMachineOut(@Query("page") int page, @Query("limit") int size, @Query("status") String status, @Query("text") String text);

    //获取机械出租详情
    @GET("v1/app/rentInfo/getMachineDetail")
    Observable<BaseEntity<AddMachineOutEntity>> getPublishMachineOutDetail(@Query("no") String id, @Query("categoryType") String categoryType);

    //机械出租上下架
    @POST("v1/app/rentInfo/putOut")
    Observable<BaseEntity> machineOutOnlineOrOff(@Body Map map);

    //机械出租删除
    @POST("v1/app/rentInfo/delete")
    Observable<BaseEntity> delMachineOutList(@Body Map map);

    //获取用户认证所有企业信息
    @GET("api/auth/getCompanyAuthInfo")
    Observable<BaseEntity<AuthEntity<List<MachineryCompanyEntity>>>> getAuthInfo();

    //新增编辑求租发布
    @POST("api/wantedInfo")
    Observable<BaseEntity> addMachineIn(@Body AddMachineInEntity entity);

    //新增编辑求租发布
    @PUT("api/wantedInfo")
    Observable<BaseEntity> editMachineIn(@Body AddMachineInEntity entity);

    //获取机械求租列表
    @GET("api/wantedInfo")
    Observable<BaseEntity<ListResponse<List<MachineStateEntity>>>> getPublishMachineIn(@Query("page") int page, @Query("limit") int size, @Query("status") String status);

    //机械求租上下架
    @POST("api/wantedInfo/frontUpDown")
    Observable<BaseEntity> machineInOnlineOrOff(@Query("id") String id, @Query("status") String status);

    //机械求租删除
    @DELETE("api/wantedInfo/{id}")
    Observable<BaseEntity> delMachineInList(@Path("id") String id);

    //获取机械出租详情
    @GET("api/wantedInfo/{id}")
    Observable<BaseEntity<AddMachineInEntity>> getPublishMachineInDetail(@Path("id") String id);

    //修改手机号
    @POST("v1/app/phoneNum/modify")
    Observable<BaseEntity> changeMobile(@Body Map map);

    //修改密码
    @POST("v1/app/resetPass")
    Observable<BaseEntity> changePwd(@Body Map map);

    //发票信息
    @POST("v1/app/user/invoice")
    Observable<BaseEntity> commitBankInfo(@Body Map map);


    // 收货地址 http://47.98.204.104:3000/mock/104/v1/app/
    // 收货地址-收货地址列表信息
    @POST("v1/app/user/address")
    Observable<BaseEntity<ListResponse<List<UserAddressEntity>>>> getUserAddressList();

    // 收货地址-根据id删除收货地址
    @POST("v1/app/user/address/delete")
    Observable<BaseEntity> delAddress(@Query("id") String id);

    // 收货地址-根据id查询收货地址
    @GET("v1/app/user/address/queryById")
    Observable<BaseEntity<UserAddressEntity>> searchAddress(@Query("id") String id);

    // 收货地址-根据id编辑收货地址
    @POST("v1/app/user/address/modify")
    Observable<BaseEntity> editAddress(@Body UserAddressEntity userAddressEntity);

    // 收货地址-添加收货地址
    @POST("v1/app/user/address/add")
    Observable<BaseEntity> addAddress(@Body UserAddressEntity userAddressEntity);

    // 商品发布-获取商品列表
    @GET("v1/app/products")
    Observable<BaseEntity<GoodsEntity>> getGoodsList(@Query("status") String status);

    // 商品发布-商品下架
    @POST("v1/app/products/off")
    Observable<BaseEntity> downGoods(@Query("id") String id);

    // 商品发布-商品上架
    @POST("v1/app/products/on")
    Observable<BaseEntity> upGoods(@Query("id") String id);

    // 商品发布-删除商品
    @POST("v1/app/products/delete")
    Observable<BaseEntity> deleteGoods(@Query("id") String id);

    //商品发布-新增商品
    @POST("v1/app/products/add")
    Observable<BaseEntity> addGoods(@Body AddGoodsEntity entity);

    /*** 招采接口开始 zkw ***/

    //投标报价-投标邀请
    @GET("v1/app/user/recruitment/getBiddingInviteList")
    Observable<BaseEntity<ListResponse<List<BidInvitationListEntity>>>> getBidInvitationList(@Query("pageNum") int page, @Query("pageSize") int size);

    //投标报价-投标详情
    @GET("v1/app/user/recruitment/getBiddingDetail")
    Observable<BaseEntity<BidDetailEntity>> getBidDetail(@Query("id") String id);

    /*** 招采接口结束 zkw ***/

    //商品报价-商品列表-3
    @POST("v1/app/user/goods/myGoodsList")
    Observable<BaseEntity<ListResponse<List<GoodsListEntity3>>>> getGoodsList(@Body Map map);

    //商品报价-全部条件字典-3
    @POST("v1/app/user/goods/goodsStatusCategory")
    Observable<BaseEntity<List<DictEntity3>>> getGoodsAllDict();

    //商品报价-批量上下架-3
    @POST("v1/app/user/goods/upDown")
    Observable<BaseEntity> upDowngetGoods(@Body Map map);

    //商品报价-批量改价-3
    @POST("v1/app/user/goods/updatePrice")
    Observable<BaseEntity> modifyGoodsPrice(@Body Map map);

    //商品详情-改价-3
    @POST("v1/app/user/products/modifyPrice")
    Observable<BaseEntity> modifyGoodsDetailPrice(@Query("id") String id, @Query("price") String price);

    //集采管理-我的集采(弃用)
    @POST("v1/app/groupBuy/myGroupBuyList")
    Observable<BaseEntity<ListResponse<List<SelfPickListEntity3>>>> getCollectList(@Body Map map);

    //集采管理-我的集采列表删除(由我发起)
    @POST("v1/app/groupBuy/deleteGroupBuying")
    Observable<BaseEntity> deleteCollectList(@Query("groupbuyingNo") String no);

    //集采管理-我的集采列表删除(我的加盟)
    @POST("v1/app/groupBuy/deleteJoin")
    Observable<BaseEntity> deleteCollectList2(@Query("groupbuyingNo") String no);
}

